package sauvaget;

public class Color {

	private int hue;
	private int saturation;
	private int value;
	private int numPixels;
	private EnumColor colorName;

	public Color(int hue, int saturation, int value, int numPixels) {
		this.setHue(hue);
		this.saturation = saturation;
		this.value = value;
		this.numPixels = numPixels;
	}

	public int getHue() {
		return hue;
	}

	public void setHue(int hue) {
		this.hue = hue;
		defineColor(hue);
	}

	public int getSaturation() {
		return saturation;
	}

	public void setSaturation(int saturation) {
		this.saturation = saturation;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	public int getNumPixels() {
		return numPixels;
	}

	public void setNumPixels(int numPixels) {
		this.numPixels = numPixels;
	}

	public EnumColor getColorName() {
		return colorName;
	}

	private void defineColor(int hue) {
		if (hue >= 0 && hue < 10) {
			this.colorName = EnumColor.RED;
		} else if (hue >= 10 && hue < 40) {
			this.colorName = EnumColor.ORANGE;
		} else if (hue >= 40 && hue < 75) {
			this.colorName = EnumColor.YELLOW;
		} else if (hue >= 75 && hue < 150) {
			this.colorName = EnumColor.GREEN;
		} else if (hue >= 150 && hue < 250) {
			this.colorName = EnumColor.BLUE;
		} else if (hue >= 250 && hue < 340) {
			this.colorName = EnumColor.VIOLET;
		} else if (hue >= 340 && hue <= 360) {
			this.colorName = EnumColor.RED;
		} else {
			System.out.println("Values between 0 - 360");
		}
	}
}
